package com.xu.model;

import com.fasterxml.jackson.annotation.JsonView;
import com.openx.xframework.common.model.BaseModel;
import com.xu.view.UserView;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;


import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

@ApiModel("用户信息")
public class User implements BaseModel<Integer> {
	private static final long serialVersionUID = 1L;

	@JsonView(UserView.Public.class)
	@ApiModelProperty(value = "用户ID", example = "1")
	private Integer id = null;

	@JsonView(UserView.Public.class)
	@ApiModelProperty(value = "用户名", required = true, example = "张三", notes = "名字不能为空 & 名字必须由2~20个字组成")
	@NotBlank(message = "名字不能为空或者空串")
	@Length(min = 2, max = 20, message = "名字必须由2~20个字组成")
	private String username = null;

	@JsonView(UserView.All.class)
	@ApiModelProperty(value = "密码", required = true, example = "superSafe@123456", notes = "密码不能为空 & 密码必须由6~20个字组成")
	@NotBlank(message = "密码不能为空或者空串")
	@Length(min = 6, max = 20, message = "密码必须由6~20个字组成")
	private String password = null;

	@JsonView(UserView.Admin.class)
	@NotBlank(message = "盐值不能为空")
	@Length(min = 3, max = 10, message = "盐值必须由3~10个字组成")
	@ApiModelProperty(value = "加密盐值", required = true, example = "dcjoin312bu1", notes = "盐值必须由3~10个字组成")
	private String salt = null;

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getSalt() {
		return salt;
	}

	public void setSalt(String salt) {
		this.salt = salt;
	}

	public User() {
	}

}
